/*******************************************************************************
 * Copyright (c) 2008 CEA LIST.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     CEA LIST - initial API and implementation
 *******************************************************************************/

package com.cea.papyrus.core.utils;

import java.util.ArrayList;
import java.util.Collection;

/**
 * Util class for {@link Collection}	
 */
public class CollectionUtils {
	
	public static <T, S extends T> Collection<S> filteredCollection(Collection<T> collection, IFilter filter) {
		Collection<S> coll = new ArrayList<S>();
		for( T o : collection) {
			if(filter.isAllowed(o)) {
				coll.add((S)o);
			}
		}
		return coll;
	}
}
